
namespace BookShareWebApp
{
   public class SQLBookRepository : IBookRepository  {

        private readonly BookContext _context;
        private List<Book> _bookList;

        public IEnumerable<Book> GetAllBooks() {

                return _context.Book.ToList();
        }
        public Book GetBook(int id) {
            return _bookList.FirstOrDefault(x => x.id == id);
        }

        public Book Insert(Book book) {
            book.id = _bookList.Max(b => b.id) + 1;
            _bookList.Add(book);
            return book;
        }

    }
}